package org.gui;

import org.mysql.MySQL;

public class Position {
	private int x, y;

	public void setX(int x) {
		this.x = x;
	}

	public int getX() {
		return x;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getY() {
		return y;
	}
	
	public Position()
	{
		updatePosition();
	}
	
	public void updatePosition()
	{
		// MySQL Instance
		MySQL conn = MySQL.getInstance();
		
		// Position query
		conn.query("SELECT spalte, zeile FROM tbl_positionen WHERE idtyp = 1");
		String[] row = conn.getNextRow();
		
		// Call setter
		this.setX(Integer.parseInt(row[0]));
		this.setY(Integer.parseInt(row[1]));
	}
	
}
